<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Location对象</title>

</head>
<body>
    <button id="refresh">刷新</button>
    <button id="info">改变地址栏的信息</button>
    <button id="href">获取地址栏的信息</button>
</body>
</html>
<script>
    var refresh = document.getElementById("refresh");
    var info = document.getElementById("info");
    var href = document.getElementById("href");
    refresh.onclick=function () {
        location.reload();//进行刷新
    }
    info.onclick=function(){
        location.href="https://www.baidu.com";//将地址栏改变
    }
    href.onclick=function () {
        alert(location.href);//弹出地址栏的信息

    }
</script>